
#include "atomic_op_namespace.h"

#if !defined(_KERNEL) && !defined(_STANDALONE)
#include <stdbool.h>
#endif
#include <sys/atomic.h>

bool bool_compare_and_swap_2(volatile uint16_t *, uint16_t, uint16_t, ...)
    asm("__sync_bool_compare_and_swap_2");

bool
bool_compare_and_swap_2(volatile uint16_t *addr, uint16_t oldval,
	uint16_t newval, ...)
{
	return atomic_cas_16(addr, oldval, newval) == oldval;
}
